package com.example.bzh.gamecat.ui.live.hot;

import android.util.Log;

import com.example.bzh.gamecat.bean.hot.Hotbean;
import com.example.bzh.gamecat.config.HttpUrl;
import com.example.bzh.gamecat.httputils.hotlive.HotHttpHelper;

import java.util.HashMap;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * Created by peter on 2016/8/17.
 */
public class HotPresenter implements HotContract.Presenter {

    private HotContract.Mode mode;
    private HotContract.View view;

    public HotPresenter(HotContract.Mode mode, HotContract.View view) {
        this.mode = mode;
        this.view = view;
    }

    @Override
    public void getData() {
        HashMap<String, String> params = new HashMap<>();
        params.put(HttpUrl.key.CURRENT, "0");
        params.put(HttpUrl.key.PAGESIZE, "20");
        params.put(HttpUrl.key.PPINF, "0%7C1471350757%7C0%7CdWlkOjkyNjkzNHxuaWNrbmFtZTolRTQlQjglODAlRTklOUQlQTIlRTQlQjglODAlRTclOUIlQjQlRTQlQjglODAlRTclOTQlOUZ8dmVyaWZpZWQ6MHxyZWd0aW1lOjE0NzEzNTA3NTd8dXNlcm5hbWU6MTM0MTI2MQ");
        params.put(HttpUrl.key.TOKEN, "46196dac1b268efebd0df5247f490e25");
        mode.getData(params, new Callback<Hotbean>() {
            @Override
            public void onResponse(Call<Hotbean> call, Response<Hotbean> response) {
                view.onGetDataSuccess(response.body());
            }

            @Override
            public void onFailure(Call<Hotbean> call, Throwable t) {
                view.onGetDataFaild("加載失敗");
            }
        });
    }
}
